package com.huajx.hanvon.handler;

import Com.FirstSolver.Splash.FaceId_Item;
import com.huajx.core.kit.AsyncHttpClientKit;
import com.huajx.core.message.RequestMessage;
import com.huajx.core.message.ResponseMessage;
import com.huajx.hanvon.Const;
import com.huajx.hanvon.HanvonTcpServer;
import com.huajx.util.StrUtil;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.util.Map;

import org.apache.mina.core.session.IoSession;

public class ReturnHandler extends AbstractHanvonHandler {
    @Override
    public ResponseMessage handler(RequestMessage request) {
        String result = FaceId_Item.GetKeyValue(request.getMessage().toString(), "result");
        Object con = request.getSession().getAttribute("con");
        String content = String.valueOf(con);
        if ("success".equals(result) && StrUtil.isNotBlank(content)) {
            Map<String, Object> paras = getPara(request.getSession());
            paras.put("content", content);
            AsyncHttpClientKit.post(HanvonTcpServer.config.getServerUrl() + Const.instruction_update_status, paras, content1 -> {

            });

        }
       
        return null;
    }
    @Override
    public void render(IoSession session) {
    	//Return(result="fail" reason="Command Not Support")
    }
    
   
}
